home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14448 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.cern.ch!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Trace C memory allocation
  5. Date: 15 Apr 96 00:32:43 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.829528363@news.cern.ch>
  8. References: <4ks3n2$2mt@news.hklink.net>
  9. NNTP-Posting-Host: sp067.cern.ch
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=US-ASCII
  12. Content-Transfer-Encoding: 7bit
  13.  
  14. In <4ks3n2$2mt@news.hklink.net> alex@station.net (Alex Chu) writes:
  15.  
  16. >    I using the Turbo C 2.0 for DOS at this moment.  I wonder that how can
  17. >I trace the memory allocation in C.  The 'Add Watch' option only can
  18. >trace the memory variable.  If I use the Free() function, how could I
  19. >know the pointer is really freed or not ?
  20.  
  21. Dunno about Free() (there ain't no such function in C), but if you pass
  22. a pointer returned by [mc]alloc or realloc to free(), it _will_ be freed.
  23. Of course, you can't tell that it's been freed by looking at its value,
  24. but if you need to be able to do this, simply set it to NULL right after
  25. calling free().
  26.  
  27. Dan
  28. --
  29. Dan Pop
  30. CERN, CN Division
  31. Email: danpop@mail.cern.ch 
  32. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  33.